import request from '/@/utils/request';

export function permissionApi() {
	return {
		createPermission: (data: object) => {
			return request({
				url: '/sys/perm/api/create',
				method: 'POST',
				data,
			});
		},
		updatePermission: (data: object) => {
			return request({
				url: '/sys/perm/api/update',
				method: 'PUT',
				data,
			});
		},
		deletePermission: (id: any) => {
			return request({
				url: `sys/perm/api/delete/${id}`,
				method: 'DELETE',
			});
		},
		batchDeletePermission: (data: object) => {
			return request({
				url: '/sys/perm/api/batchdelete',
				method: 'POST',
				data,
			});
		},
		viewPermission: (id: any) => {
			return request({
				url: `sys/perm/api/view/${id}`,
				method: 'GET',
			});
		},
		searchPermission: (data: object) => {
			return request({
				url: 'sys/perm/api/search',
				method: 'POST',
				data,
			});
		},
		all: () => {
			return request({
				url: 'sys/perm/api/all',
				method: 'GET',
			});
		},
        allTypes: () => {
            return request({
                url: 'sys/perm/api/all/types',
                method: 'GET',
            })
        }
	};
}
